package demo10;

import sun.reflect.generics.tree.Tree;

import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

public class Test {
    public static void main(String[] args) {
        String str = "1.2,3.4,5.6,7.8,5.56,44.55";
        String[] arr = str.split(",");
        TreeMap<Integer, Integer> tm = new TreeMap<Integer, Integer>((e1, e2) ->
                e1.compareTo(e2) == 0 ? 1 : e1.compareTo(e2));
        for (int i = 0; i < arr.length; i++) {
            String[] arr1 = arr[i].split("\\.");
            tm.put(Integer.parseInt(arr1[0]), Integer.parseInt(arr1[1]));
        }
        for (Map.Entry<Integer, Integer> entry : tm.entrySet()) {
            System.out.println(entry.getKey() + ":" + entry.getValue());
        }
    }
}